package ch03_oothinking.serializable;

import lombok.Data;

import java.io.Serializable;

/**
 * 串行化是将对象转换成某种格式的字节数组
 * 串行化使用场景：将对象进行网络间的传输；本地化存储
 */
@Data
public class Student implements Serializable {
    public static final long serialVersionUID = 1234L;

    private long studentId;
    private String name;
    private transient int age;

    public Student() {
    }

    public Student(long studentId, String name, int age) {
        super();
        this.studentId = studentId;
        this.name = name;
        this.age = age;

        System.out.println("Constructor");
    }

    public String toString() {
        return String.format("%d - %s - %d", studentId, name, age);
    }
}
